Skip to content

test(ios): resolve the host app before stubbing its tree snapshot - #2633

Merged
thymikee merged 1 commit into
callstack:mainfrom
okwasniewski:oskar/harden-tree-capture-occupancy-test
Sep 15, 2026
Merged

thymikee merged 1 commit into
callstack:mainfrom
okwasniewski:oskar/harden-tree-capture-occupancy-test

Conversation

@okwasniewski

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #2621. Running the iOS suite on a freshly booted simulator, with testAbandonedTreeCaptureSkipsQuerySweepAndHonorsWarmupExemption as the first test to launch the host app, the test runner was killed with SIGTERM about 30 s in (Test crashed with signal term; the console showed Find the Target Application and then nothing for 28 s). A probe build confirmed the stub is entered only from captureSnapshotRoot, so the intended block is the tree XPC; the cold first launch adds a slow resolution of the application element inside the plan.

The test now resolves the element before installing the stub (wait(for: .runningForeground) plus one frame read) and gives the plan wait 60 s instead of 30, so a slow cold path cannot tear the test down while the plan is still running. 1 file, +5/-1.

Validation

Tested commit 09d30bfbe.

  • The test alone from a cold boot, three times (shutdown, boot, run): passed in 12.0 s, 11.8 s, 15.0 s, no runner restart.
  • Full iOS runner suite from a fresh boot with this test first to launch the app: 248 tests, 0 failures, no runner restart.
  • xctest-selection, packaged-runner-swift, format pass.

Running the suite on a freshly booted simulator, with this test as the
first to launch the host app, the runner was killed with SIGTERM about
30 s in ("Test crashed with signal term"). The stub only ever blocks the
tree XPC, but a cold first launch adds a slow "Find the Target
Application" resolution inside the plan. Resolve the application element
before installing the stub, and give the plan wait 60 s instead of 30 so a
slow cold path cannot tear the test down while the plan still runs.

Verified with three cold-boot runs of the test and one full suite from a
fresh boot (248 tests, 0 failures, no runner restart).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved review issues were identified, and validation passed.

Pull request overview

This PR hardens the iOS snapshot occupancy test against slow cold launches.

Changes:

  • Resolves the host app and reads its frame before installing the stub.
  • Extends the plan wait timeout from 30 to 60 seconds.
File summaries
File Summary
apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+SnapshotCapturePlanOccupancyTests.swift Stabilizes cold-launch snapshot occupancy coverage.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@thymikee
thymikee merged commit e3cbc91 into callstack:main Sep 15, 2026
13 checks passed
@thymikee

Copy link
Copy Markdown
Member

Clean at 09d30bf. Resolving the app element before the stub is installed, and giving the plan wait 60 s, keeps the cold first launch out of the blocked tree snapshot without changing what the test asserts. The change stays inside one XCTest file, all checks pass and there are no conflicts; the cold-boot runs in the PR body cover the changed setup.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants